// 统一请求路径前缀在libs/axios.js中修改
import { getRequest, postRequest, putRequest, getNoAuthRequest, postNoAuthRequest } from '@/libs/axios';



// 文件上传接口
// export const uploadFile = "/file/uploadFile"
// 验证码渲染图片接口
export const drawCodeImage = "/xboot/common/captcha/draw/"
// 获取菜单
export const getMenuList = "/xboot/permission/getMenuList"
// 获取数据字典
export const getDictData = "/dictData/getByType/"


// 获取帖子列表
export const getPostList = (params) => {
    return postRequest('post/getPostList', params)
}

// 获取帖子详情
export const getPostDetail = (params) => {
    return postRequest('post/getPostDetail', params)
}

// 移除帖子
export const removePost = (params) => {
	return postRequest('post/removePost', params)
}

/**
 * 山正或者测评
 * */

// 新增或者修改山正帖子
export const saveOrUpdateSzAppraisal = (params) => {
    return postRequest('xboot/szAppraisal/saveOrUpdateSzAppraisal', params)
}

//获取山正帖子列表
export const getSzAppraisalList = (params) => {
    return postRequest('xboot/szAppraisal/getSzAppraisalList', params)
}

//获取山正帖子详情
export const getSzAppraisalDetail = (params) => {
    return postRequest('xboot/szAppraisal/getSzAppraisalDetail', params)
}

//移除山正帖子
export const removeSzAppraisal = (params) => {
    return postRequest('xboot/szAppraisal/removeSzAppraisal', params)
}

// 删除评论
export const removeSzOrRealComment = (params) => {
	return postRequest('xboot/szAppraisalComment/removeSzAppraisalComment', params)
}

/**
 * 举报信息
 * */

// 获取举报信息列表
export const getReportList = (params) => {
	return postRequest('report/getReportList', params)
}

// 移除举报
export const removeReport = (params) => {
	return postRequest('report/remove', params)
}

// 获取全部抽奖分类
export const getAllGiftClassifyList = () => {
	return getRequest('xboot/drawCategory/getAll')
}

// 通过id获取抽奖分类
export const getAllGiftClassifyById = (params) => {
	return getRequest(`xboot/drawCategory/get/${params}`)
}

// 新增或者编辑抽奖分类
export const insertOrUpdateGiftClassify = (params) => {
	return postRequest('xboot/drawCategory/insertOrUpdate', params)
}

// 删除抽奖分类
export const removeGiftClassify = (params) => {
	return postRequest('xboot/drawCategory/delByIds', params)
}

// 根据抽奖分类获取抽奖组数据
export const getGiftArrById = (params) => {
	return postRequest('xboot/drawProductGroupProduct/getDrawProductList', params)
}

// 获取抽奖组详情
export const getGiftArrDetail = (params) => {
	return postRequest('xboot/drawProductGroupProduct/getDrawProductGroupDetail', params)
}

// 新增抽奖组
export const insertGiftArr = (params) => {
	return postRequest('xboot/drawProductGroupProduct/saveDrawProductGroup', params)
}

// 修改抽奖组
export const updateGiftArr = (params) => {
	return postRequest('xboot/drawProductGroupProduct/updateDrawProductGroup', params)
}

// 移除抽奖组
export const removeGiftArr = (params) => {
	return postRequest('xboot/drawProductGroupProduct/removeDrawProductGroup', params)
}

/**
 * 上新商品
 * */

// 列表
export const getNewProductList = (params) => {
	return postRequest('xboot/newGood/getNewGoodList', params)
}

// 详情
export const getNewProductDetail = (params) => {
	return postRequest('xboot/newGood/getNewGoodDetail', params)
}

// 新增或编辑
export const insertOrUpdateNewProduct = (params) => {
	return postRequest('xboot/newGood/saveOrUpdateNewGood', params)
}

// 批量移除
export const removeNewProduct = (params) => {
	return postRequest('xboot/newGood/removeNewGood', params)
}

/**
 * 轮播图
 * */
 
// 列表
export const getSwiperList = () => {
	return getRequest('xboot/banner/getAll')
}

// 详情
export const getSwiperById = (params) => {
	return postRequest(`xboot/banner/get/${params}`)
}

// 新增或编辑
export const insertOrUpdateSwiper = (params) => {
	return postRequest('xboot/banner/insertOrUpdate', params)
}

// 批量删除
export const removeSwipers = (params) => {
	return postRequest('xboot/banner/delByIds', params)
}


/**
 * 订单模块
 * */
 
// 列表
export const getOrderList = (params) => {
	return postRequest('xboot/order/getOrderList', params)
}

// 详情
export const getOrderDetail = (params) => {
	return postRequest('xboot/order/getOrderDetail', params)
}

// 删除
export const removeOrder = (params) => {
	return postRequest('xboot/order/removeOrders', params)
}

// 发货
export const sendOrder = (params) => {
	return postRequest('xboot/order/sendProduct', params)
}


/**
 * 公告模块
 * */
 
// 公告列表
export const getNoticeList = (params) => {
	return postRequest('xboot/notice/getNoticeList', params)
}

// 增加或修改
export const addOrEditNotice = (params) => {
	return postRequest('xboot/notice/saveOrUpdateNotice', params)
}

// 删除
export const delNotice = (params) => {
	return postRequest('xboot/notice/removeNotice', params)
}




// 登陆
export const login = (params) => {
    return postNoAuthRequest('/login', params)
}
// 获取用户登录信息
export const userInfo = (params) => {
    return getRequest('/user/info', params)
}
// 注册
export const regist = (params) => {
    return postNoAuthRequest('/user/regist', params)
}
// 初始化验证码
export const initCaptcha = (params) => {
    return getNoAuthRequest('/common/captcha/init', params)
}
// IP天气信息
export const ipInfo = (params) => {
    return getRequest('/common/ip/info', params)
}
// 个人中心编辑
export const userInfoEdit = (params) => {
    return postRequest('/user/edit', params)
}
// 个人中心修改密码
export const changePass = (params) => {
    return postRequest('/user/modifyPass', params)
}
// 解锁
export const unlock = (params) => {
    return postRequest('/user/unlock', params)
}




// 获取用户数据 多条件
export const getUserListData = (params) => {
    return getRequest('/user/getByCondition', params)
}
// 通过用户名搜索
export const searchUserByName = (username, params) => {
    return getRequest('/user/searchByName/'+username, params)
}
// 获取全部用户数据
export const getAllUserData = (params) => {
    return getRequest('/user/getAll', params)
}
// 通过部门获取全部用户数据
export const getUserByDepartmentId = (id, params) => {
    return getRequest(`/user/getByDepartmentId/${id}`, params)
}
// 添加用户
export const addUser = (params) => {
    return postRequest('/user/admin/add', params)
}
// 编辑用户
export const editUser = (params) => {
    return postRequest('/user/admin/edit', params)
}
// 启用用户
export const enableUser = (id, params) => {
    return postRequest(`/user/admin/enable/${id}`, params)
}
// 禁用用户
export const disableUser = (id, params) => {
    return postRequest(`/user/admin/disable/${id}`, params)
}
// 删除用户
export const deleteUser = (params) => {
    return postRequest('/user/delByIds', params)
}
// 重置用户密码
export const resetUserPass = (params) => {
    return postRequest('/user/resetPass', params)
}



// 获取一级部门
export const initDepartment = (params) => {
    return getRequest('/department/getByParentId/0', params)
}
// 加载部门子级数据
export const loadDepartment = (id, params) => {
    return getRequest(`/department/getByParentId/${id}`, params)
}
// 添加部门
export const addDepartment = (params) => {
    return postRequest('/department/add', params)
}
// 编辑部门
export const editDepartment = (params) => {
    return postRequest('xboot/department/edit', params)
}
// 删除部门
export const deleteDepartment = (params) => {
    return postRequest('xboot/department/delByIds', params)
}
// 搜索部门
export const searchDepartment = (params) => {
    return getRequest('xboot/department/search', params)
}



// 获取全部角色数据
export const getAllRoleList = (params) => {
    return getRequest('/role/getAllList', params)
}
// 分页获取角色数据
export const getRoleList = (params) => {
    return getRequest('/role/getAllByPage', params)
}
// 添加角色
export const addRole = (params) => {
    return postRequest('/role/save', params)
}
// 编辑角色
export const editRole = (params) => {
    return postRequest('/role/edit', params)
}
// 设为或取消注册角色
export const setDefaultRole = (params) => {
    return postRequest('/role/setDefault', params)
}
// 分配角色权限
export const editRolePerm = (params) => {
    return postRequest('/role/editRolePerm', params)
}
// 分配角色数据权限
export const editRoleDep = (params) => {
    return postRequest('/role/editRoleDep', params)
}
// 删除角色
export const deleteRole = (params) => {
    return postRequest('/role/delByIds', params)
}



// 获取全部权限数据
export const getAllPermissionList = (params) => {
    return getRequest('/permission/getAllList', params)
}
// 加载数据
export const loadPermission = (id, params) => {
    return getRequest(`/permission/getByParentId/${id}`, params)
}
// 添加权限
export const addPermission = (params) => {
    return postRequest('/permission/add', params)
}
// 编辑权限
export const editPermission = (params) => {
    return postRequest('/permission/edit', params)
}
// 删除权限
export const deletePermission = (params) => {
    return postRequest('/permission/delByIds', params)
}
// 搜索权限
export const searchPermission = (params) => {
    return getRequest('/permission/search', params)
}



// 获取全部字典
export const getAllDictList = (params) => {
    return getRequest('/dict/getAll', params)
}
// 添加字典
export const addDict = (params) => {
    return postRequest('/dict/add', params)
}
// 编辑字典
export const editDict = (params) => {
    return postRequest('/dict/edit', params)
}
// 删除字典
export const deleteDict = (params) => {
    return postRequest('/dict/delByIds', params)
}
// 搜索字典
export const searchDict = (params) => {
    return getRequest('/dict/search', params)
}
// 获取全部字典数据
export const getAllDictDataList = (params) => {
    return getRequest('/dictData/getByCondition', params)
}
// 添加字典数据
export const addDictData = (params) => {
    return postRequest('/dictData/add', params)
}
// 编辑字典数据
export const editDictData = (params) => {
    return postRequest('/dictData/edit', params)
}
// 删除字典数据
export const deleteData = (params) => {
    return postRequest('/dictData/delByIds', params)
}
// 通过类型获取字典数据
export const getDictDataByType = (type, params) => {
    return getRequest(`/dictData/getByType/${type}`, params)
}



// 分页获取日志数据
export const getLogListData = (params) => {
    return getRequest('/log/getAllByPage', params)
}
// 删除日志
export const deleteLog = (params) => {
    return postRequest('/log/delByIds', params)
}
// 清空日志
export const deleteAllLog = (params) => {
    return postRequest('/log/delAll', params)
}


// 分页获取Redis数据
export const getRedisData = (params) => {
    return getRequest('/redis/getAllByPage', params)
}
// 通过key获取Redis信息
export const getRedisByKey = (key, params) => {
    return getRequest(`/redis/getByKey/${key}`, params)
}
// 获取Redis键值数量
export const getRedisKeySize = (params) => {
    return getRequest('/redis/getKeySize', params)
}
// 获取Redis内存
export const getRedisMemory = (params) => {
    return getRequest('/redis/getMemory', params)
}
// 获取Redis信息
export const getRedisInfo = (params) => {
    return getRequest('xboot/redis/info', params)
}
// 添加编辑Redis
export const saveRedis = (params) => {
    return postRequest('/redis/save', params)
}
// 删除Redis
export const deleteRedis = (params) => {
    return postRequest('/redis/delByKeys', params)
}
// 清空Redis
export const deleteAllRedis = (params) => {
    return postRequest('/redis/delAll', params)
}



// 分页获取定时任务数据
export const getQuartzListData = (params) => {
    return getRequest('/quartzJob/getAllByPage', params)
}
// 添加定时任务
export const addQuartz = (params) => {
    return postRequest('/quartzJob/add', params)
}
// 编辑定时任务
export const editQuartz = (params) => {
    return postRequest('/quartzJob/edit', params)
}
// 暂停定时任务
export const pauseQuartz = (params) => {
    return postRequest('/quartzJob/pause', params)
}
// 恢复定时任务
export const resumeQuartz = (params) => {
    return postRequest('/quartzJob/resume', params)
}
// 删除定时任务
export const deleteQuartz = (params) => {
    return postRequest('/quartzJob/delByIds', params)
}



// base64上传
export const base64Upload = (params) => {
    return postRequest('/upload/file', params)
}